package org.jeecg.modules.monitoring.j_monitoring.job.dataSync;

import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang.StringUtils;
import org.jeecg.common.util.DateUtils;
import org.jeecg.modules.monitoring.j_monitoring.entity.MGlDriveCabinet;
import org.jeecg.modules.monitoring.j_monitoring.entity.MGlRegulator;
import org.jeecg.modules.monitoring.j_monitoring.entity.MGlStorageResources;
import org.jeecg.modules.monitoring.j_monitoring.entity.MGlVirtualMachine;
import org.jeecg.modules.monitoring.j_monitoring.gatewayData.Virtual;
import org.jeecg.modules.monitoring.j_monitoring.mapper.MGlVirtualMachineMapper;
import org.jeecg.modules.monitoring.j_monitoring.service.IMGlDriveCabinetService;
import org.jeecg.modules.monitoring.j_monitoring.service.IMGlRegulatorService;
import org.jeecg.modules.monitoring.j_monitoring.service.IMGlStorageResourcesService;
import org.jeecg.modules.monitoring.j_monitoring.service.impl.MGlStorageResourcesServiceImpl;
import org.jeecg.modules.monitoring.j_monitoring.service.impl.MGlVirtualMachineServiceImpl;
import org.jeecg.modules.monitoring.j_monitoring.service.impl.MGlVirtualizationClusterServiceImpl;
import org.quartz.Job;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.List;

/**
 * 虚拟机集群绑定虚机数量 与 存储系统已用空间数据记录脚本
 */
@Slf4j
public class DataAddLogSyncJob implements Job {

    @Autowired
    private MGlVirtualMachineServiceImpl machineService;

    @Autowired
    private MGlStorageResourcesServiceImpl storageResourcesService;

    /***
     * 执行
     * @param jobExecutionContext
     * @throws JobExecutionException
     */
    @Override
    public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {

        log.info(String.format("存储关联数据开始--时间:" + DateUtils.getTimestamp()));
        machineService.addNumberLog();

        storageResourcesService.syncAddLog();

        log.info(String.format("存储关联数据结束---时间:" + DateUtils.getTimestamp()));
    }
}
